﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AnChao.WPF.Controls.TextBox.Controls
{
	public class FormatRegex
	{
		public const string IntegerInput = @"^(0|[1-9]\d*)$";

        public const string NumberInput = @"^(\d*)$";

        public const string StockCodeInput = @"^(\d{1,6})$";

        public const string SignIntegerInput = @"^(0|-?[1-9]\d*)$";

        public const string DecimalInput = @"^(0|[1-9]\d*)(\.\d*)?$";
        public const string DecimalInput_IntegerPart_AllowNegativeOne = @"(-1?|(0|[1-9](\d{0,$0}))?";
        public const string DecimalInput_IntegerPart = @"((0|[1-9](\d{0,$0}))?";
        public const string DecimalInput_DecimalPart = @"(\.(\d{0,$0})?)?)";
        public const string DecimalInput_NonDecimalPart = @")";

        public const string SignDecimalInput = @"^(0|-?[1-9]\d*)(\.\d*)?$";
        public const string SignDecimalInput_IntegerPart = @"(-?(0|[1-9](\d{0,$0})?)?";

        //public const string SignDecimalInput = @"^(0|-?([1-9]\d*))(\.\d*)?$";
        //public const string SignDecimalInput_IntegerPart = @"(0|-?([1-9])(\d{0,$0})";

		public const string TimeValidate_H24MM = @"^((2[0-3])|([0-1][0-9])):(([1-5][0-9])|0([0-9]))$";
		public const string TimeInput_H24MM = @"^((2[0-3]?)|([0-1][0-9]?))(:(([1-5][0-9]?)|0([0-9]?))?)?$";

        public const string DateValidate_YYYYMMDD = @"^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$";

        public const string DateValidate_NULLORYYYYMMDD = @"^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$";

        public const string TelephoneNumber = @"((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)";

        public const string IpAddress = @"^(([1-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5])))\.)(([0-9]|([0-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5])))\.){2}([1-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5])))$";

		public const string IpAddressAndPort = @"\b((?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])):([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[0-9]|[1-9][0-9]|[1-9][0-9][0-9][0-9]|[1-5]][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9]|65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5])\b";

        public const string IdentifyNumber = @"([1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx])|([1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx])";

        public const string EmailInput = @"^[\w\-\u4e00-\u9fa5]+([-+.][\w\-\u4e00-\u9fa5]+)*@[\w\-\u4e00-\u9fa5]+([-.][\w\-\u4e00-\u9fa5]+)*\.[\w\-\u4e00-\u9fa5]+([-.][\w\-\u4e00-\u9fa5]+)*$";

        public const string PostCodeInput=@"^[0-9]{6}$";

        public const string IsContainNumber = @"^[0-9]+";

        public const string NumberWithComma = @"^[0-9\,]+$";

        /// <summary>
        ///中文 数字 |
        /// </summary>
        public const string AcctID = @"^[\u4E00-\u9FA5A-Za-z0-9|]+$";
        /// <summary>
        ///中文 数字 | ^
        /// </summary>
        public const string AcctID1 = @"^[\u4E00-\u9FA5A-Za-z0-9|^]+$";
    }
}
